package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsCallCenterReportsAgentEventVolumePageUtil extends SeleniumPageUtil {
	public final static By RCCRAEV_SPAN_DATE_RANGE = By.id("ctl44_lblDateRange");
	public final static By RCCRAEV_SPAN_REQD = By.xpath("//*[@id='ctl44_tblDateRange']/tbody/tr/td[1]/span[2]");
	public final static By RCCRAEV_INPUT_START_DATE = By.id("ctl44_dteStartDate_txtDatePart");
	public final static By RCCRAEV_IMG_START_DATE = By.id("ctl44_dteStartDate_imgDateCalendar");
	public final static By RCCRAEV_DIV_START_DATE_CLOSE = By.id("ctl44_dteStartDate_txtDatePart_CalendarExtender_close");
	public final static By RCCRAEV_INPUT_END_DATE = By.id("ctl44_dteEndDate_txtDatePart");
	public final static By RCCRAEV_IMG_END_DATE = By.id("ctl44_dteEndDate_imgDateCalendar");
	public final static By RCCRAEV_DIV_END_DATE_CLOSE = By.id("ctl44_dteEndDate_txtDatePart_CalendarExtender_close");
	public final static By RCCRAEV_INPUT_SUBMIT = By.id("ctl44_btnDateRange");
	
	public final static By RCCRAEV_SPAN_HEADER = By.id("ctl44_Report_Header_lblHeader");
	
	public final static By RCCRAEV_IMG_REPORT_PREFERENCES = By.id("ctl44_Report_Header_imgPreferences");
	public final static By RCCRAEV_IMG_EXPORT = By.id("ctl44_Report_Header_imgExcelExport");
	
	public final static By RCCRAEV_TD_PAGE = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[3]/tbody/tr/td[1]");
	public final static By RCCRAEV_SPAN_PAGE_START_NO = By.id("ctl44_Report_PagingTop_lblPagingPageNumber");
	public final static By RCCRAEV_TD_OF = By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table[3]/tbody/tr/td[3]");
	public final static By RCCRAEV_SPAN_PAGE_COUNT = By.id("ctl44_Report_PagingTop_lblPagingPageCount");
	
	public final static By RCCRAEV_INPUT_FIRST = By.id("ctl44_Report_PagingTop_imgFirst");
	public final static By RCCRAEV_INPUT_PREVIOUS = By.id("ctl44_Report_PagingTop_imgPrevious");
	public final static By RCCRAEV_INPUT_NEXT = By.id("ctl44_Report_PagingTop_imgNext");
	public final static By RCCRAEV_INPUT_LAST = By.id("ctl44_Report_PagingTop_imgLast");
	
	public final static By RCCRAEV_IMG_FILTER_0 = By.id("ctl44_Report_filter_0");
	public final static By RCCRAEV_IMG_FILTER_1 = By.id("ctl44_Report_filter_1");
	public final static By RCCRAEV_TH_CREATED_BY = By.id("ctl44_Report_sort_0");
	public final static By RCCRAEV_TH_EVENT_CODE = By.id("ctl44_Report_sort_1");
	public final static By RCCRAEV_TH_TOTAL = By.id("ctl44_Report_sort_2");
	
	public static void enterReportsCallCenterReportsAgentEventVolumePage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_AGENT_EVENT_VOLUME));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RCCRAEV_IMG_EXPORT, RCCRAEV_INPUT_FIRST, RCCRAEV_INPUT_PREVIOUS, RCCRAEV_INPUT_NEXT,RCCRAEV_INPUT_LAST, 
				RCCRAEV_IMG_FILTER_0, RCCRAEV_IMG_FILTER_1, RCCRAEV_IMG_START_DATE, RCCRAEV_IMG_END_DATE, RCCRAEV_INPUT_SUBMIT
			});
//		SmsSeleniumUtil.isDisplayed(SmsSeleniumUtil.findElement(RCCRAEV_IMG_REPORT_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_IMG_EXPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_INPUT_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_INPUT_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_INPUT_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_INPUT_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_IMG_FILTER_0));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_IMG_FILTER_1));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_IMG_START_DATE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_IMG_END_DATE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCCRAEV_INPUT_SUBMIT));
	}
}
